<? include ("../init.php") ?>
<?
  if($_POST['list1SortOrder']!=''){
    $newImgOrderArray = explode('|',$_POST['list1SortOrder']);
    $i = 1;
    $result = array();
    foreach($newImgOrderArray as $value)
    {
      $sql = 'UPDATE gallery SET img_position='.($i++).' WHERE img_id='.$value;
      $db->execute($sql);
    }
  }
  header("Location:index.php");
?>